<template>
  <div id="app">
    <transition name="fade" mode="out-in">
      <!-- 给出口设置keep-alive 不要做过多ajax请求干扰切页的流畅度 -->
      <keep-alive
        exclude="swiperRow,nowPlaying,comingSoon,films,filmIdView,cinemas,CinemaList,CityList,CinemaDetails,noCinemas,choseseat"
      >
        <router-view />
      </keep-alive>
    </transition>
    <!-- 这里是底部导航栏 -->
    <van-tabbar v-model="active" active-color="#EE7621" inactive-color="#000" v-if="show">
      <van-tabbar-item icon="shop-o" @click="turnToFilm">电影</van-tabbar-item>
      <van-tabbar-item icon="label-o" @click="turnToCinemas">影院</van-tabbar-item>
      <van-tabbar-item icon="shopping-cart-o" @click="turnToMzact">资讯</van-tabbar-item>
      <van-tabbar-item icon="user-o" @click="turnToCenter">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: null
    };
  },
  computed: {
    msg() {
      return this.active;
    },
    show() {
      return this.$store.state.show;
    }
  },
  methods: {
    turnToFilm() {
      this.$router.push({
        path: "/",
        query: {
          id: 1,
          k: Math.random() * 12346789 + 13
        }
      });
    },
    turnToCinemas() {
      this.$router.push({
        path: "/cinemas",
        query: {
          id: 2,
          k: Math.random() * 12356789 + 12
        }
      });
    },

    turnToMzact() {
      this.$router.push({
        path: "/mzact",
        query: {
          id: 3,
          k: Math.random() * 12345689 + 11
        }
      });
    },
    turnToCenter() {
      this.$router.push({
        path: "/center",
        query: {
          id: 4,
          k: Math.random() * 12345679 + 10
        }
      });
    }
  }
};
</script>






<style>
.fade-enter-active,
.fade-leave-active {
  transition: all 0.5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
  /* transform: translateY(30px); */
}
</style>